/**
 * 
 */
package com.agilegroup.crm.requests;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;

import com.agilegroup.crm.model.Call;
import static com.agilegroup.crm.utils.CONSTANTS.*;
import com.octo.android.robospice.request.springandroid.SpringAndroidSpiceRequest;

/**
 * @author hisham
 *
 */
public class NewCallJsonRequest extends SpringAndroidSpiceRequest<Call>{

	private Call call;
	
	public NewCallJsonRequest(Call call) {
		super(Call.class);
		this.call=call;
	}
	@Override
	public Call loadDataFromNetwork() throws Exception {
		HttpHeaders httpHeaders = new HttpHeaders();
		httpHeaders.setContentType(MediaType.APPLICATION_JSON);
		HttpEntity<Call>httpEntity = new HttpEntity<Call>(call,httpHeaders);
		return getRestTemplate().postForObject(ADD_CALL_POST, httpEntity, Call.class);
	}
}